SYS.MEM.ALLOC
0x0000
NET.UPLINK
ESTABLISHING
SEC.PROTOCOL
AWAITING
DATA.STREAM
0.0.0.0
0%
INITIALIZING SYSTEM
[
]
Portfolio Learn Month 02 Networking Basics

🌐 Day 16: HTTP Headers - Part 2

Networking Web HTTP

Today's session is a deep dive into advanced headers that hackers use to break into big systems. We focused on the Request Hijacking attack that won awards from PortSwigger and worked against giants like Google and Netflix. 🌐


πŸ—οΈ 1. Request Smuggling / Hijacking

This is a high-level attack that happens because modern websites use two "guards": a Frontend Proxy (outer guard) and a Backend Server (inner guard).

πŸ•΅οΈβ€β™‚οΈ The Heist Logic

An attacker sends a request that has two different rules for counting data at the same time: Content-Length (The Ruler) and Transfer-Encoding: chunked (The Conveyor Belt).

POST / HTTP/1.1
Content-Length: 15
Transfer-Encoding: chunked

0
HELP_ME_HACK

🎭 2. User-Agent: The Mask

If the Host header lies about "Where are you going?" and the Cookie header lies about "Who you are," the User-Agent header lies about "What you are."

This header tells the server about your OS (Windows/Mac/Linux) and your browser (Chrome/Firefox/Safari) so it can serve the right layout for mobile or desktop.

πŸ•΅οΈβ€β™‚οΈ The 5 Big "Hacker Lies"


πŸ‘£ 3. Referer: The Digital Footprints

This header (historically misspelled) tells the server where you were just before you clicked the link.

The Traps:

  1. Bypassing Trusted Checks: Some bad admin panels check: "Is the user coming from the login page?" If yes, they let them in. A hacker just manually writes Referer: https://bank.com/login to trick the server into thinking they are an "insider."
  2. Information Leakage: If you are on a private page with a secret token in the URL (reset?token=SECRET_123) and you click a link to an external site, your browser "tells" that external site your secret token in the Referer header!
  3. Open Redirects: A hacker uses a trusted site to "vouch" for a bad site by using a redirect parameter.

πŸ›‘οΈ 4. Origin: The Security Badge

The Origin is like the Referer, but it is automatically attached by your browser. You can change your own Origin, but you cannot easily force a victim's browser to lie about it.

The Attack: The "Cat Video" Trap (CSRF)

Imagine you are logged into your bank. In another tab, you watch a "Funny Cat Video" on a hacker's site.

The "CORS" Goldmine:

Lazy developers often use a wildcard: Access-Control-Allow-Origin: *. This means anyone can talk to the server. A hacker can then write a script to reach into the site and read your private messages.


πŸš€ 5. Location: The Teleporter

This is a Response Header. It tells your browser: "Hey, the thing you want isn't here. Go there instead."

The "Bad Guy" Hack: Open Redirect

Hackers look for sites that use a "Redirect Parameter" like ?next=.


πŸ“Š Summary Table of the 10 Headers

# Header Type The Hacker's "Dirty" Goal
1HostRequestFind hidden private sites or fake password reset links.
2CookieBothSession Hijacking: Steal the ID card to log in as the user.
3AuthorizationRequestJWT Cracking: Change roles to "Admin" or crack secrets.
4Content-TypeBothBypass Uploads: Upload a virus but label it as a "Photo."
5Content-LengthRequestSmuggling: Lie about data size to hide secret commands.
6Transfer-EncodingRequestSmuggling: Use "chunked" pieces to confuse server guards.
7User-AgentRequestMasking: Pretend to be Googlebot or a mobile phone.
8RefererRequestTrust Bypass: Lie about where you came from to enter admin areas.
9OriginRequestCSRF: Exploit lazy servers that don't check the "Badge."
10LocationResponseOpen Redirect: Teleport victims to a fake phishing site.